//
// Created by Guoshun WU on 2021/2/20.
//

#ifndef AVSTUDY_WGSMPLAYER_H
#define AVSTUDY_WGSMPLAYER_H

#include <SDL.h>
#include <opusfile.h>

struct CallbackParameter {
    OggOpusFile *file;
    SDL_AudioDeviceID dev;
};

class WGSMPlayer {

    CallbackParameter currentCallbackParams{nullptr, 0};
    const char *currentPlayingFile{nullptr};


public:

    WGSMPlayer();

    static void SDLCALL

    opusFileFeedCallBack(void *userdata, unsigned char *stream, int len);

    int playOggOpusFile(const char *file);

    int startSDLEventLoop();

    int stopPlaying();


};

int testWGSMPlayer(int argc, char *argv[]);

#endif //AVSTUDY_WGSMPLAYER_H
